<?php
/*
 * Reads image from temp folder
 */
if (array_key_exists('f', $_GET)) {
    $temp_dir = sys_get_temp_dir();
    $file = $temp_dir . '/' . str_replace(array('/', '\\', ':'), '', $_GET['f']);
    if (substr($file, -strlen(".gif") == '.gif') && file_exists($file)) {
        $size = filesize($file);
        header("Content-Length: " . filesize($file));
        header("Content-type: image/gif");
        readfile($file);
    }
}